package week8;

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main2 {
	public static void main(String[] args) {
		Set<String> words = new TreeSet<String>();
		Scanner in = new Scanner(System.in);
		while(true){
			String a = in.next();
			if(a.equals("!!!!!"))
				break;
			words.add(a);
		}
		System.out.println(words.size());
		int i=0;
		for (String e : words) {
			if(i<10)
			{
				System.out.println(e);
				i++;
			}
		}
	}
}
